<template>
  <div class="width-style">

    <el-row :gutter="20" class="page-top">
      <el-col :span="2" style="height: 200px;">
        <div  class="traditional-medical-care-img">
          <img alt='' src="@/assets/images/traditionalMedicalCare.jpg"/>
        </div>
      </el-col>
      <el-col :span="5">
        <div class="tmc-title">
          <span>
            传统医学养生
          </span>
        </div>
      </el-col>
      <el-col :span="7">
        <div class="introduce">
          <span>
            中医养生，就是指通过各种方法颐养生命、增强体质、预防疾病，从而达到延年益寿的一种医事活动。中医养生重在整体性和系统性，目的是提前预防疾病，治未病。中医理论的著名代表作品是《黄帝内经》。中医养生来自古代精华医学，当代中医水平有所下降，而古代中医值得后人继续开发和研究。
          </span>
        </div>
      </el-col>
      <el-col :span="10">
        <img alt='' src="@/assets/images/huangdineijing.jpg" class="huangdineijing" />
      </el-col>
<!--      <el-col :span="6">-->
<!--        <div style="min-height: 36px;height: 240px;">-->
<!--          <Download />-->
<!--        </div>-->
<!--      </el-col>-->
    </el-row>

    <el-row :gutter="20">
      <el-col :span="18">
        <div class="grid-content">
          <InnerModuleLong innerModuleName="食疗养生" :list="dietList"  :picSrc="require('@/assets/images/foodHealth.jpg')" routeName="/traditionalmedicalcare/diet"/>
          <InnerModuleLong innerModuleName="艾灸疗法" :list="moxibustionList"  :picSrc="require('@/assets/images/moxibustion.jpg')" routeName="/traditionalmedicalcare/moxibustion"/>
          <InnerModuleLong innerModuleName="针灸疗法" :list="acupunctureList" :picSrc="require('@/assets/images/needle.jpg')" routeName="/traditionalmedicalcare/acupuncture"/>
          <InnerModuleLong innerModuleName="推拿法" :list="manipulationList" :picSrc="require('@/assets/images/massage.jpg')" routeName="/traditionalmedicalcare/manipulation"/>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="grid-content">
          <ModuleAdviser :doctorList="doctorList"/>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import LevelOnePageTop from '@/components/levelOnePageTop'
import {renderTime} from '@/utils/tools.js'
export default {
  name: "BodyGuide",
  layout: "homeLayout",
  // components: { LevelOnePageTop },
  async asyncData({app}) {
    //获取当前类下的最热文章
    let res = await app.api.reqGeneralAllByCatalogue(11);
    if (res.code === 200) {
      for (let item of res.rows) {
        item.publishTime = renderTime(item.publishTime);
      }
    }
    //获取医生等列表
    let doctorRes=await app.api.reqAllDoctor();
    if(doctorRes.code===200){
      for(let doctor of doctorRes.rows){
        doctor.doctorAvatar=app.api.BASEURL+doctor.doctorAvatar
      }
    }

    let moxibustionRes1 = await app.api.reqCoreGeneralByPage(116,1,3);
    let moxibustionRes2 = await app.api.reqCoreGeneralByPage(117,1,3);
    let moxibustionRes3 = await app.api.reqCoreGeneralByPage(118,1,3);
    let moxibustionRes4 = await app.api.reqCoreGeneralByPage(119,1,3);
    //获取当类下的子分类的文章
    let dietRes = await app.api.reqCoreGeneralByPage(36,1,5);//食疗
    if (dietRes.code === 200) {
      for (let item of dietRes.rows) {
        item.publishTime = renderTime(item.publishTime);
      }
    }
    let moxibustionList // 艾灸
    if (moxibustionRes1.code === 200&&moxibustionRes2.code===200&&moxibustionRes3.code===200&&moxibustionRes4.code===200) {
      moxibustionList=moxibustionRes1.rows.concat(moxibustionRes2.rows,moxibustionRes3.rows,moxibustionRes4.rows)
      for (let item of moxibustionList) {
        item.publishTime = renderTime(item.publishTime);
      }
    }
    let acupunctureRes = await app.api.reqCoreGeneralByPage(38,1,5);//针灸
    if (acupunctureRes.code === 200) {
      for (let item of acupunctureRes.rows) {
        item.publishTime = renderTime(item.publishTime);
      }
    }
    let manipulationRes = await app.api.reqCoreGeneralByPage(39,1,5);//推拿
    if (manipulationRes.code === 200) {
      for (let item of manipulationRes.rows) {
        item.publishTime = renderTime(item.publishTime);
      }
    }
    return {
      doctorList:doctorRes.rows,
      dietList:dietRes.rows,
      // moxibustionList:moxibustionRes.rows,
      moxibustionList,
      acupunctureList:acupunctureRes.rows,
      manipulationList:manipulationRes.rows,
    }
  },
};
</script>

<style scoped lang="less">
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.tmc-title{
  width: 210px;
  height: 60px;
  margin-top: 80px;
  font-size: 24px;
  background: rgba(153, 232, 140, 0.25);
  border-radius: 20px;
  text-align: center;
  line-height: 60px;
}
.traditional-medical-care-img {
  width: 72px;
  height: 80px;
  margin-top: 70px;
  display: flex;
  line-height: 200px;
}
.introduce{
  margin-top: 40px;
  font-size: 18px;
  text-align: left;
}
.huangdineijing{
  width: 500px;
  height: 250px;
}

</style>
